package com.nariano.server.domain.engine.droolsimpl;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;

import org.springframework.util.Assert;

import com.nariano.server.domain.entities.PopulationType;
import com.nariano.server.domain.utils.PopulationTypeList;
import com.nariano.server.services.statistics.PopulationDistribution;
import static com.nariano.server.domain.entities.PopulationType.*;

/**
 * Manages resourecs created within kingdom.
 * A resource is the value of all food and goods created in kingdom.
 */
public class ResourceCreator {
	
	private static final int CREATE_RESOURCE_FACTOR = 3;
	
	public int create(PopulationDistribution distr) {
		return distr.getPoupulationCount(PopulationType.PEASENT) * CREATE_RESOURCE_FACTOR;
	}

	public int consume(PopulationDistribution distr) {
		int consume = 0;
		for(PopulationType p : PopulationType.values()) {
			consume += distr.getPoupulationCount(p)*p.getConsumeFactor();
		}
		return consume;
	}

}
